import requests
url = 'https://fanyi.baidu.com/sug'
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) '
                      'AppleWebKit/537.36 (KHTML, like Gecko) '
                      'Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43'}
word = input("输入要翻译的单词或汉字：")
data = {'kw':word}
response = requests.post(url,data=data,headers=headers)
#解析数据
rs = response.json()
#print(rs) #rs[dict]->data[list]->dict
#查看翻译结果
rs_list = rs['data']
for item in rs_list:
    print(item.get('v'))
